<template>
  <el-dialog
    :title="titleName"
    :visible.sync="visible"
    width="70vw"
    top="8vh"
    :close-on-click-modal="false"
    @close="closeDialog"
  >
    <div :height="searchheight" v-loading.fullscreen.lock="fullscreenLoading">
      <span
        style="float: right; margin-top: -30px; cursor: pointer"
        @click="searchchangeadvanced"
        >{{ searchadvanced ? "收起" : "展开" }}
        <i
          :class="searchadvanced ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
        />
      </span>
      <div v-show="searchadvanced">
        <div class="boxsty">
          <el-row>
            <el-form
              :model="dataForm"
              :rules="dataRule"
              ref="dataForm"
              @keyup.enter.native="dataFormSubmit()"
              label-width="130px"
            >
              <el-col :span="24">
                <el-col :span="6">
                  <el-form-item label="合同名称:" prop="contractName">
                    <el-input
                      :disabled="!contractAuditStatus == 0"
                      v-model="dataForm.contractName"
                      placeholder="合同名称"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="合同有效期:" required>
                    <el-col :span="10">
                      <el-form-item prop="htYxqq">
                        <el-date-picker
                          :disabled="!contractAuditStatus == 0"
                          v-model="dataForm.htYxqq"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="开始日期"
                          style="width: 100%"
                        ></el-date-picker>
                      </el-form-item>
                    </el-col>
                    <el-col :span="4">
                      <div class="text-center">至</div>
                    </el-col>
                    <el-col :span="10">
                      <el-form-item prop="htYxqz">
                        <el-date-picker
                          :disabled="!contractAuditStatus == 0"
                          v-model="dataForm.htYxqz"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="结束日期"
                          style="width: 100%"
                        ></el-date-picker>
                      </el-form-item>
                    </el-col>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="签订日期:" prop="signDate">
                    <el-date-picker
                      :disabled="!contractAuditStatus == 0"
                      v-model="dataForm.signDate"
                      type="date"
                      value-format="yyyy-MM-dd"
                      placeholder="签订日期"
                      style="width: 100%"
                    ></el-date-picker>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :span="24">
                <el-col :span="6">
                  <el-form-item label="签订级别:" prop="signLevel">
                    <el-select
                      class="xiaLa'"
                      :disabled="!contractAuditStatus == 0"
                      v-model="dataForm.signLevel"
                      placeholder="请选择签订级别"
                      style="width: 100%"
                      :clearable="true"
                    >
                      <el-option
                        v-for="(item, index) in qdjbList"
                        :key="index"
                        :label="item.name"
                        :value="item.value"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="多人合同模式:" prop="multiMode">
                    <el-select
                      :disabled="!contractAuditStatus == 0"
                      v-model="dataForm.multiMode"
                      placeholder="请选择多人合同模式"
                      class="xiaLa"
                      style="width: 100%"
                      :clearable="true"
                    >
                      <el-option
                        v-for="(item, index) in drhtmsList"
                        :key="index"
                        :label="item.name"
                        :value="item.value"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="考核周期:" prop="contractCycle">
                    <el-select
                      :disabled="!contractAuditStatus == 0"
                      v-model="dataForm.contractCycle"
                      placeholder="请选择考核周期"
                      class="xiaLa"
                      style="width: 100%"
                      :clearable="true"
                    >
                      <el-option
                        v-for="(item, index) in htzqList"
                        :key="index"
                        :label="item.name"
                        :value="item.value"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="模板名称:" prop="templateId">
                    <el-select
                      v-if="temDisabled"
                      :disabled="!contractAuditStatus == 0"
                      v-model="dataForm.templateId"
                      placeholder="模板名称"
                      class="xiaLa"
                      style="width: 100%"
                      :clearable="true"
                    >
                      <el-option
                        v-for="(item, index) in categoryList"
                        :key="index"
                        :label="item.templateName"
                        :value="item.id"
                      ></el-option>
                    </el-select>
                    <el-input v-else v-model="dataForm.templateName" disabled placeholder="请输入内容"></el-input>
                  </el-form-item>
                </el-col>
              </el-col>
            </el-form>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-col :span="12">
                <div>
                  <div
                    style="
                      float: left;
                      width: 118px;
                      margin-right: 12px;
                      text-align: right;
                    "
                    v-if="contractAuditStatus == 0"
                  >
                    <!-- <el-button
                      type="text"
                      icon="el-icon-user-solid"
                      @click="addUser('fy')"
                    ></el-button> -->
                    <img style="float:right;width:30px;height:auto;cursor: pointer;" @click="addUser('fy')" src='/img/addP.png'/>
                  </div>
                  <div
                    style="
                      float: left;
                      width: 118px;
                      margin-right: 12px;
                      text-align: right;
                      font-size: 16px;
                      color: #303745;
                    "
                    v-else
                  >
                    发约人:
                  </div>
                  <div style="float: left">
                    <div v-if="contractAuditStatus == 0">
                      <el-badge
                        :hidden="fayuerendataList.length < 3"
                        :value="fayuerendataList.length"
                        class="item"
                        style="font-size: 16px; color: #303745"
                      >
                        发约人
                      </el-badge>
                    </div>
                    <div>
                      <span
                        class="mg-r15"
                        v-for="item in fayuerendataList.slice(0, 2)"
                      >
                        <el-tooltip
                          class="item"
                          :disabled="fayuerendataList.length < 3"
                          effect="dark"
                          :content="shaiXuan(fayuerendataList, '发约人')"
                          placement="top-start"
                        >
                          <span style="font-size: 16px; color: #303745"
                            >{{ item.fayueName }}--{{
                              validatenull(item.fayueZhiwu)
                                ? "-"
                                : item.fayueZhiwu
                            }}</span
                          >
                        </el-tooltip>
                      </span>
                    </div>
                  </div>
                </div>
              </el-col>
              <el-col :span="12">
                <div>
                  <div
                    style="
                      float: left;
                      width: 118px;
                      margin-right: 12px;
                      text-align: right;
                    "
                    v-if="contractAuditStatus == 0"
                  >
                    <!-- <el-button
                      icon="el-icon-user-solid"
                      type="text"
                      v-if="!showRentPrise"
                      @click="addUser('sy')"
                    ></el-button> -->
                    <img v-if="!showRentPrise" style="float:right;width:30px;height:auto;cursor: pointer;" @click="addUser('sy')" src='/img/addP.png'/>
                    <el-button
                      icon="el-icon-user-solid"
                      type="text"
                      v-if="showRentPrise"
                      @click="addUser('jg')"
                    >
                    </el-button>
                  </div>
                  <div
                    style="
                      float: left;
                      width: 118px;
                      margin-right: 12px;
                      text-align: right;
                      font-size: 16px;
                      color: #303745;
                    "
                    v-else
                  >
                    <span v-if="!showRentPrise">受约人:</span>
                    <span v-if="showRentPrise">机构:</span>
                  </div>
                  <div style="float: left">
                    <div>
                      <span class="mg-l10" v-if="contractAuditStatus == 0">
                        <el-radio v-model="radio" label="1" @change="radiojg"
                          ><el-badge
                            :hidden="shouyuerendataList.length < 3"
                            :value="shouyuerendataList.length"
                            class="item"
                            >受约人</el-badge
                          ></el-radio
                        >
                        <el-radio v-model="radio" label="2" @change="radiojg"
                          ><el-badge
                            :hidden="jigoudataList.length < 3"
                            :value="jigoudataList.length"
                            class="item"
                            >受约机构</el-badge
                          ></el-radio
                        >
                      </span>
                    </div>
                    <div>
                      <span
                        class="mg-r15"
                        v-if="!showRentPrise"
                        v-for="item in shouyuerendataList.slice(0, 2)"
                      >
                        <el-tooltip
                          class="item"
                          :disabled="shouyuerendataList.length < 3"
                          effect="dark"
                          :content="shaiXuan(shouyuerendataList, '受约人')"
                          placement="top-start"
                        >
                          <span style="font-size: 16px; color: #303745">
                            {{ item.shouyueName }}、{{
                              validatenull(item.shouyueZhiwu)
                                ? "-"
                                : item.shouyueZhiwu
                            }}
                          </span>
                        </el-tooltip>
                      </span>
                      <span
                        class="mg-r15"
                        v-if="showRentPrise"
                        v-for="item in jigoudataList.slice(0, 2)"
                      >
                        <el-tooltip
                          class="item"
                          :disabled="jigoudataList.length < 3"
                          effect="dark"
                          :content="shaiXuan(jigoudataList, '机构')"
                          placement="top-start"
                        >
                          <span style="font-size: 16px; color: #303745">{{
                            item.jigouName
                          }}</span>
                        </el-tooltip>
                      </span>
                    </div>
                  </div>
                </div>
              </el-col>
            </el-col>
          </el-row>
        </div>
      </div>
    </div>
    <!--合同指标填报-->
    <div>
      <el-row>
        <el-col :span="24">
          <zhibiaoForm
            ref="zhibiaoRef"
            :zhibiaoForm="zhibiaoForm"
            v-on:zhibiaoChild="zhibiaoChild"
            :hetongId="hetongId"
            :radio="radio"
            :contractName="contractName"
          ></zhibiaoForm>
        </el-col>
      </el-row>
    </div>
    <!--    发送指标部门-->
    <el-dialog
      title="请选择指标拟定部门"
      :close-on-click-modal="false"
      :visible.sync="zbvisible"
      append-to-body
    >
      <div style="height: 50vh">
        <el-row>
          <el-col :span="8">
            <div class="text-center">
              <el-tree
                :data="treeOrgData"
                show-checkbox
                node-key="id"
                :default-expanded-keys="[2, 3]"
                :default-checked-keys="[5]"
                :props="defaultProps"
                @check-change="handleCheckChange"
              >
              </el-tree>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="text-center" style="line-height: 50vh">
              <el-button type="primary" @click="fnConfirmSelectedData"
                >选择机构<i class="el-icon-d-arrow-right el-icon--right"></i
              ></el-button>
            </div>
          </el-col>
          <el-col :span="10">
            <div class="text-center">
              <el-table :data="confirmTreeData" border>
                <el-table-column
                  prop="label"
                  header-align="center"
                  align="center"
                  label="机构名称"
                >
                </el-table-column>
                <el-table-column
                  header-align="center"
                  align="center"
                  label="操作"
                >
                  <template slot-scope="scope">
                    <el-button type="danger" plain size="small">删除</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </el-col>
        </el-row>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="zbvisible = false">推送</el-button>
        <el-button type="primary" plain @click="zbvisible = false"
          >返回</el-button
        >
      </span>
    </el-dialog>
    <!--  选择人员信息-->
    <UserCommonSelect
      v-if="usercomment"
      ref="usercomment"
      @refreshDataList="getDataList"
      @submitfy="submitfy"
    ></UserCommonSelect>
    <!--  选择机构-->
    <OrgCommonSelect
      v-if="orgcomment"
      ref="orgcomment"
      @refreshDataList="getDataList"
      @submitfy="submitfy"
    ></OrgCommonSelect>
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" plain @click="addDateHT" v-if="titleName == '新增'||contractAuditStatus==0">保存</el-button>
      <el-button type="primary" plain @click="closeDialog">返回</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { selHzBmList } from "@/api/ceping/cepinghzgldxpzb";
import UserCommonSelect from "@/views/hetongrenwu/components/usercomment-select";
import OrgCommonSelect from "@/views/hetongrenwu/components/orgcomment-select";
import zhibiaoForm from "@/views/hetongrenwu/components/zhibiao-form.vue";
import {
  getNiDingList,
  exportExcel,
  effective,
} from "@/api/hetongrenwu/hetongyeji/hetongnd";
import { saveHtong } from "@/api/hetongrenwu/hetongyeji/hetongnd";
import { validatenull } from "@/util/validate";
import store from "@/store";

export default {
  components: {
    UserCommonSelect,
    OrgCommonSelect,
    zhibiaoForm,
  },
  data() {
    var checkDate = (rule, value, callback) => {
      if (value) {
        if (
          new Date(value.replace(/-/g, "/")) <
          new Date(this.dataForm.htYxqq.replace(/-/g, "/"))
        ) {
          callback("结束日期不能小于开始日期!");
        } else {
          callback();
        }
      } else {
        callback("请选择结束日期");
      }
    };
    var checkDateKai = (rule, value, callback) => {
      if (value) {
        if (
          new Date(value.replace(/-/g, "/")) >
          new Date(this.dataForm.htYxqz.replace(/-/g, "/"))
        ) {
          callback("开始日期不能大于结束日期!");
        } else {
          callback();
        }
      } else {
        callback("请选择开始日期");
      }
    };
    return {
      myHeaders: {
        Authorization: "Bearer " + store.getters.access_token,
      },
      titleName: "",
      isbtnHidden: false,
      xgBz: false,
      visible: false,
      fullscreenLoading: false,
      radio: "1",
      canSubmit: false,
      showPrise: true, // 受约人DIV
      showRentPrise: false, // 机构DIV
      cityOptions: [],
      jjData: [], //奖金池
      jjxList: [], //奖金项list
      fzbmData: [],
      dataForm: {
        templateId:"",
      },
      taskDefKey: "",
      dataRule: {
        contractName: [
          { required: true, message: "合同名称不能为空", trigger: "blur" },
        ],
        htYxqq: [{ validator: checkDateKai, trigger: "change" }],
        htYxqz: [{ validator: checkDate, trigger: "change" }],
        // auditProcess:[
        //    {required: true, message: '请选择审批流程', trigger: 'change'}
        // ],
        signDate: [
          { required: true, message: "请选择签订日期", trigger: "change" },
        ],
        signLevel: [
          { required: true, message: "请选择签订级别", trigger: "change" },
        ],
        multiMode: [
          { required: true, message: "请选择多人合同模式", trigger: "change" },
        ],
        contractCycle: [
          { required: true, message: "请选择考核周期", trigger: "change" },
        ],
        templateId: [
          { required: true, message: "请选择模板名称", trigger: "change" },
        ],
      },
      lcspList: [
        { name: "2021年全员绩效考核通用流程", value: "1" },
        { name: "2021年第一季度技术合同流程", value: "2" },
      ],
      qdjbList: [
        { name: "一级合同", value: "1" },
        { name: "二级合同", value: "2" },
        { name: "三级合同", value: "3" },
        { name: "四级合同", value: "4" },
        { name: "五级合同", value: "5" },
      ],
      drhtmsList: [
        { name: "多人共享成绩", value: "0" },
        { name: "生成多个合同", value: "1" },
      ],
      htzqList: [
        { name: "月度", value: "1" },
        { name: "季度", value: "2" },
        { name: "年度", value: "3" },
      ],
      categoryList: [],
      fayuerendataList: [],
      shouyuerendataList: [],
      shouyueNameList: [],
      jigoudataList: [],
      zbvisible: false,
      treeOrgData: [],
      defaultProps: {
        children: "children",
        label: "label",
      },
      confirmTreeData: [
        {
          id: 5,
          label: "二级机构",
        },
      ],
      selectedTreeData: [],
      usercomment: false,
      orgcomment: false,
      searchadvanced: true,
      searchheight: "0",
      jsonData: "",
      zhibiaoForm: {},
      hetongId: Number,
      contractName: "",
      contractAuditStatus: 0,
      htzbList: [],
      temDisabled:Boolean,
    };
  },
  watch: {
    radio(value) {
      if (value) {
        this.cheakDiv(value);
      }
    },
  },
  created() {
    this.getTreeData();
  },
  methods: {
    //筛选出姓名与职务
    shaiXuan(data, type) {
      var list = [],
        obj = {};
      if (type == "受约人") {
        for (var i in data) {
          list.push(data[i].shouyueName +  "(" + data[i].shouyueZhiwu + ")");
        }
      }
      if (type == "机构") {
        for (var i in data) {
          list.push(data[i].jigouName);
        }
      }
      if (type == "发约人") {
        for (var i in data) {
          list.push(data[i].fayueName + "(" + data[i].fayueZhiwu + ")");
        }
      }
      return list.toString();
    },
    download() {
      exportExcel().then((response) => {
        this.$message.closeAll();
        this.$message.success("导出成功!");
        let url = window.URL.createObjectURL(new Blob([response.data]));
        let link = document.createElement("a");
        link.style.display = "none";
        link.href = url;
        link.setAttribute("download", "人员模板.xlsx");
        document.body.appendChild(link);
        link.click();
      });
    },
    //指标子集传过来
    zhibiaoChild(zhibiaoChild) {
      if (zhibiaoChild == "驳回") {
        this.closeDialog();
        this.visible = false;
      } else {
        this.htzbList = zhibiaoChild;
      }
      if(this.titleName == '编辑'){
        saveHtong(Object.assign(this.dataForm, { htzbList: this.htzbList })).then(res=>{
          this.$message.closeAll()
          this.$message.success("添加成功")
          this.$refs.zhibiaoRef.getDataList()
        })
      }
    },
    // 获取下拉
    fneffective() {
      effective({
        tagName:"业绩合同"
      }).then((res) => {
        this.categoryList = res.data.data;
        var shows = {};
        shows = this.categoryList.find(ele=>{
          return ele.id == this.dataForm.templateId;
        })
        console.log(shows)
        if(shows==undefined&&this.titleName!="新增"){
          this.temDisabled = false
        }else if(shows||shows == {}){
          this.temDisabled = true;
        }
        console.log("this.temDisabled",this.temDisabled)
      });
    },
    radiojg(value) {
      if (value == "1") {
        this.jigoudataList = [];
        this.$message.closeAll();
        this.$message.warning("切换至个人则机构数据为空");
      } else {
        this.shouyuerendataList = [];
        this.$message.closeAll();
        this.$message.warning("切换至机构则个人数据为空");
      }
    },
    uploadSuccessFY(response, file) {
      if (response.data.result) {
        this.fayuerendataList = response.data.data;
      } else {
        this.$message.closeAll();
        this.$message.error(response.data.data);
      }
    },
    uploadSuccessSY(response, file) {
      if (response.data.result) {
        this.shouyuerendataList = response.data.data;
      } else {
        this.$message.closeAll();
        this.$message.error(response.data.data);
      }
    },
    uploadError(err, file, fileList) {
      this.$message.closeAll();
      this.$message.error(err.msg);
      this.$refs.upload.clearFiles();
    },
    searchchangeadvanced() {
      this.searchadvanced = !this.searchadvanced;
      if (this.searchadvanced) {
        this.searchheight = "auto";
      }
    },
    //移除数据项
    removeItem(index) {
      this.dataForm.dataList.splice(index, 1);
      this.jjxZehj();
    },
    init(data, params) {
      if (data == undefined) {
        this.taskDefKey = "222";
      } else {
        this.taskDefKey = data.taskDefKey;
      }
      this.titleName = "新增";
      this.visible = true;
      if (data != undefined) {
        this.titleName = "编辑";
        this.fayuerendataList = [];
        this.shouyuerendataList = [];
        this.jigoudataList = [];
        this.isbtnHidden = true;
        this.radio = data.type.toString();
        this.dataForm = data;
        this.fayuerendataList = JSON.parse(data.fayuejson);
        if (data.type == 2) {
          if (data.multiMode == 1) {
            const jigouArr = JSON.parse(data.jigoujson);
            var obj = jigouArr.find((item) => item.jigouName == data.jigouName);
            this.jigoudataList = [obj];
          } else {
            this.jigoudataList = JSON.parse(data.jigoujson);
          }
        } else {
          if (data.multiMode == 1) {
            const shouyueArr = JSON.parse(data.shouyuejson);
            var obj = shouyueArr.find(
              (item) => item.shouyueName == data.shouyueName
            );
            this.shouyuerendataList = [obj];
          } else {
            this.shouyuerendataList = JSON.parse(data.shouyuejson);
          }
        }
        this.cheakDiv(data.type);
        this.hetongId = params.hetongId;
        this.contractName = params.contractName;
        this.zhibiaoForm = {
          enter: 0,
          disabled: true,
          formName: "htcj",
          isHideBtn: params.isHideBtn,
          contractAuditStatus: data.contractAuditStatus,
          proceid: data.proceid,
          rowid: data.id,
          taskDefKey: this.taskDefKey,
          titleName:this.titleName
        };
        this.contractAuditStatus = params.contractAuditStatus;

        this.$nextTick(() => {
          if (
            data.contractAuditStatus != 0 &&
            data.contractAuditStatus != 1 &&
            data.contractAuditStatus != 3 &&
            data.contractAuditStatus != 6 &&
            data.contractAuditStatus != 5 &&
            data.contractAuditStatus != 67
          ) {
            this.$refs.zhibiaoRef.editLock();
          }
          this.$refs.zhibiaoRef.saveForm(data);
          //  this.$refs.zhibiaoRef.getDataList();
        });
        this.$forceUpdate();
      } else {
        //感觉这个方法不用也行，暂时注释
        //this.csh();
        this.hetongId = 0;
        this.contractName = "";
        this.contractAuditStatus = 0;
        this.zhibiaoForm = {
          enter: 0,
          disabled: true,
          formName: "htcj",
          isHideBtn: false,
          taskDefKey: this.taskDefKey,
          titleName:this.titleName
        };
      }
      // this.dataForm.id = JSON.stringify(data.id) || 0;
      // this.visible = true;
      this.canSubmit = true;
      this.getTreeData();
      this.fneffective();
    },
    //树结构选中的数据
    handleCheckChange(data) {
      this.selectedTreeData = data;
    },
    //确定选择选中得机构
    fnConfirmSelectedData() {
      this.confirmTreeData = this.selectedTreeData;
    },
    //机构或受约人Div隐藏
    cheakDiv(type) {
      if (type == "1") {
        this.showPrise = true;
        this.showRentPrise = false;
      } else if (type == "2") {
        this.showPrise = false;
        this.showRentPrise = true;
      }
    },
    getDataList(data) {
      // selHzBmList('12').then(response => {
      //   this.itemData = response.data.data
      // })
    },
    //增加人员
    addUser(type) {
      if (type == "jg") {
        this.orgcomment = true;
        this.$nextTick(() => {
          this.$refs.orgcomment.init("12", type, this.jsonData, "htcj");
        });
      } else {
        this.usercomment = true;
        if (type == "fy") {
          this.jsonData = JSON.stringify(this.fayuerendataList);
        } else if (type == "sy") {
          this.jsonData = JSON.stringify(this.shouyuerendataList);
        }
        this.$nextTick(() => {
          this.$refs.usercomment.init("12", type, this.jsonData, "htcj",this.titleName,this.dataForm.multiMode);
        });
      }
    },
    addDateHT() {
      this.dataForm.fayuejson = JSON.stringify(this.fayuerendataList);
      this.dataForm.shouyuejson = JSON.stringify(this.shouyuerendataList);
      this.dataForm.jigoujson = JSON.stringify(this.jigoudataList);
      this.dataForm.type = this.radio;
      this.$refs["dataForm"].validate((valid) => {
        if (valid) {
          if (this.fayuerendataList.length == 0) {
            this.$message.closeAll();
            this.$message.warning("请选发约人");
          } else if (
            this.shouyuerendataList.length == 0 &&
            this.jigoudataList.length == 0
          ) {
            this.$message.closeAll();
            this.$message.warning("请选受约人或机构");
          } else if (this.taskDefKey.indexOf('usertask5') != -1) {
            this.$confirm("确定要保存数据么", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
            }).then(res=>{
              this.fullscreenLoading = true;
              saveHtong(Object.assign(this.dataForm, { htzbList: this.htzbList }))
                .then((res) => {
                  var that =this
                  that.$nextTick(() => {
                    that.$refs.zhibiaoRef.getDataList();
                  })
                  this.$message.closeAll();
                  this.$message.success("保存成功");
                  this.closeDialog();
                  this.fullscreenLoading = false;
                  this.$refs.zhibiaoRef.saveZhibiao();
                })
                .catch(() => {
                  this.fullscreenLoading = false;
                })
            })
          } else {
            this.fullscreenLoading = true;
            saveHtong(Object.assign(this.dataForm, { htzbList: this.htzbList }))
              .then((res) => {
                this.$message.closeAll();
                var that =this
                that.$nextTick(() => {
                    that.$refs.zhibiaoRef.getDataList();
                })
                this.$message.success("保存成功");
                this.closeDialog();
                this.fullscreenLoading = false;
                this.$refs.zhibiaoRef.saveZhibiao();
                
                
              })
              .catch(() => {
                this.fullscreenLoading = false;
              });
          }
        } else {
          return false;
        }
      });
    },
    //打开指标维护
    fnOpenZhibiao() {
      var param = {
        openZhi: true,
      };
      this.$emit("openZhibiao", param);
    },
    submitfy(data) {
      if (data.type == "fy") {
        this.fayuerendataList = data.tableDataUser;
      } else if (data.type == "sy") {
        this.shouyuerendataList = data.tableDataUser;
      } else if (data.type == "jg") {
        this.jigoudataList = data.tableDataUser;
      }
    },
    //获取树结构
    getTreeData() {
      getNiDingList().then((res) => {
        this.treeOrgData = res.data.data;
      });
    },
    //判空
    validatenull(val) {
      return validatenull(val);
    },
    //关闭当前页面的弹框
    closeDialog() {
      this.$emit("refreash", "closeDialog");
      this.visible = false;
    },
  },
};
</script>
<style scoped>
.el-divider {
  background-color: #fff;
  
}
.boxsty .el-col-16 .el-form-item {
  margin-bottom: 0px !important;
}

.inline-block {
  display: inline-block;
}
</style>
<style>
.boxsty .el-input__inner{
  color: #000 !important;
}
.xiaLaTwo .el-input--small .el-input__inner {
  border: none;
  background: transparent;
}
.xiaLaTwo .el-icon-arrow-up:before {
  content: "";
}
.el-icon-user-solid {
  font-size: 30px !important;
}
</style>
